package cz.tpj.database.aktivita_zajimavost;

import static org.junit.Assert.*;

import org.junit.Test;

import cz.tpj.database.akcia.Akcia;
import cz.tpj.database.akcia.Table_Akcia;
import cz.tpj.database.obrazky.Obrazok;
import cz.tpj.util.ErrorDatabase;

public class TableActivityInterestsTest {

	@Test
	public void testGetInstance() {
		TableActivityInterests o1 = TableActivityInterests.getInstance();
		
		assertNotNull(o1);
	}

	@SuppressWarnings("deprecation")
	@Test
	public void testAddActivityToInterest() {
		Obrazok o1 = new Obrazok();
		Akcia o2 = new Akcia("ID1", "action1", "the test action", "first action of the first test","27.12.1984","Opava","park","John Black",o1);
		Akcia o3 = new Akcia("ID2", "action2", "the test action", "second action of the first test","27.12.1984","Opava","street","John Black",o1);		

		TableActivityInterests o4 = TableActivityInterests.getInstance();
		
		String[] str = new String[2];
		
		try {
			o4.addActivityToInterest("ID2", "park");
		} catch (ErrorDatabase e) {
			e.printStackTrace();
		}
		
		str[0] = "action1";
		str[1] = "action2";
		
		try {
			assertEquals(str, o4.getActivitiesOfInterestPlace("park"));
		} catch (ErrorDatabase e) {
			e.printStackTrace();
		}		
	}
}
